package com.charzhan;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeoutException;

public class producer {
    public static final String QUE_MSG="hello";

    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("182.92.167.63");
        connectionFactory.setUsername("guest");
        connectionFactory.setPassword("guest");
        Connection connection = connectionFactory.newConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare(QUE_MSG,false,false,false,null);
        int i=0;
        while (i<9990){
            channel.basicPublish("",QUE_MSG,null,"hell".getBytes(StandardCharsets.UTF_8));
            System.out.println("message"+i);
            i++;
        }



    }
}
